﻿@{
    ViewBag.Title = "pay";
}
@section scripts
{
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <link href="@Url.Content("~/content/css/kingprt.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/content/css/bootstrap.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/content/css/KingcensSet.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/content/css/font-awesome.css")" rel="stylesheet" type="text/css" />
    <style type="text/css">
        body {
            overflow: auto !important;
        }
        a:link {
            color:black;
            text-decoration:none;
        }
        a:visited {
            color:black;
            text-decoration:none;
        }
        a:hover {
            color:black;
            text-decoration:underline;
        }
        i {
            font-style:normal;
        }

        .topup {
            width: 100%;
            height: auto;
        }
        .topupBox {
            width: 1024px;
            height: 476px;
            margin: 170px auto 0 auto;
        }
        .topup-star {
            width: 330px;
            height: 476px;
            background-color: #fff;
            border: 1px solid #E1E2E2;
            margin-right: 15px;
            float: left;
        }
         .retail {
            width: 330px;
            height: 476px;
            background-color: #fff;
            border: 1px solid #E1E2E2;
            float: left;
        }
        .box {
            width: 220px;
            height: auto;
            margin: 25px auto 0 auto;
        }
        .box h4 {
            width: 220px;
            color: #373D41;
            font-size: 20px;
            padding: 20px 0 20px 12px;
            margin: 0;
            border-bottom: 1px solid #E1E2E2;
        }
        .box span {
            width:100%;
            height: 26px;
            line-height: 26px;
            color: #FF9D00;
            font-size: 20px;
           
            float: left;
        }
        .price {
            margin-top: 83px;
        }
         .price2 {
            margin-top: 26px;
        }
        .price3 {
            margin-top: 80px;
        }
        .box span > i {
            line-height: 19px;
            color: #878B8D;
            font-size: 14px;
            margin-left: 5px;
        }
        .chooces {
            width: 100%;
            height: 28px;
            line-height: 28px;
            color:  #686868;
            font-size: 16px;
            margin-top: 28px;
            padding: 10px 0;
            float: left;
        }
        .chooces label{
            float: left;
            margin: 0;
        }
        .chooces select {
            float: left;
            width: 136px;
            height: 28px;
            border: 1px solid #DFDFDE;
        }
        .order {
            width: 100%;
            height: 36px;
            color: #fff;
            font-size: 14px;
            background-color: #00C1DF;
            border: none;
            margin-top: 15px;
        }

    </style>
}

<div class="topup">
    <div class="topupBox">
        <div class="topup-star">
            <div class="box">
                <h4>云POS星耀版</h4>
                <div class="chooces">
                    <label>后台系统：</label>
                     <select class="select" name="LI002">
                         <option value="1">启用</option>
                    </select>
                </div>
                <div class="chooces">
                    <label>前台收银：</label>
                    <select class="select" id="LI001"  name="LI001">
                        <option value="1">1站点</option>
                        <option value="2">2站点</option>
                        <option value="3">3站点</option>
                        <option value="4">4站点</option>
                        <option value="5">5站点</option>
                        <option value="6">6站点</option>
                        <option value="7">7站点</option>
                        <option value="8">8站点</option>
                        <option value="9">9站点</option>
                        <option value="10">10站点</option>
                        <option value="15">15站点</option>
                        <option value="20">20站点</option>
                        <option value="30">30站点</option>
                        <option value="50">50站点</option>
                        <option value="80">80站点</option>
                        <option value="100">100站点</option>
                    </select>
                </div>
                <div class="chooces">
                    <label>购买时长：</label>
                   <select class="select" name="iNum">
                        <option value="1">1年</option>
                        <option value="2">2年</option>
                        <option value="3">3年</option>
                        <option value="4">4年</option>
                        <option value="5">5年</option>
                    </select>
                </div>
                <span class="price">¥593.40<i>起</i></span>
                <input type="button" class="order" onclick="BillStart()" value="立即续费" />
            </div>
        </div>
        <div class="topup-star" id="retail">
            <div class="box">
                <h4>云POS企业电商版</h4>
                <div class="chooces">
                    <label>后台系统：</label>
                    <select class="select" id="LI0020" name="LI0020">
                         <option value="1">启用</option>
                    </select>
                </div>
                <div class="chooces">
                    <label>前台收银：</label>
                    <select class="select" id="LI0010"  name="LI0010">
                        <option value="1">1站点</option>
                        <option value="2">2站点</option>
                        <option value="3">3站点</option>
                        <option value="4">4站点</option>
                        <option value="5">5站点</option>
                        <option value="6">6站点</option>
                        <option value="7">7站点</option>
                        <option value="8">8站点</option>
                        <option value="9">9站点</option>
                        <option value="10">10站点</option>
                        <option value="15">15站点</option>
                        <option value="20">20站点</option>
                        <option value="30">30站点</option>
                        <option value="50">50站点</option>
                        <option value="80">80站点</option>
                        <option value="100">100站点</option>
                    </select>
                </div>
                <div class="chooces">
                    <label>购买时长：</label>
                    <select class="select" name="iNum0">
                        <option value="1">1年</option>
                        <option value="2">2年</option>
                        <option value="3">3年</option>
                        <option value="4">4年</option>
                        <option value="5">5年</option>
                    </select>
                </div>
                <div class="chooces">
                    <label>微信商城：</label>
                    <select class="select" name="LI0030">
                        <option value="1">启用</option>
                    </select>
                </div>
                <span class="price2">¥37546.2<i>起</i></span>
                <input type="button" class="order" onclick="BillStart2()" value="立即续费" />
            </div>
        </div>
        @*助手*@
        <div class="retail">
            <div class="box">
                <h4>经营助手</h4>
                <div class="chooces">
                    <label>经营助手：</label>
                    <select class="select" name="LI00200">
                         <option value="1">启用</option>
                    </select>
                </div>
                <div class="chooces">
                    <label>用户数量：</label>
                    <select class="select" id="LI00100"  name="LI00100">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                        <option value="15">15</option>
                        <option value="20">20</option>
                        <option value="30">30</option>
                        <option value="50">50</option>
                        <option value="80">80</option>
                        <option value="100">100</option>
                    </select>
                </div>
                <div class="chooces">
                    <label>购买时长：</label>
                    <select class="select" name="iNum00">
                        <option value="1">1年</option>
                        <option value="2">2年</option>
                        <option value="3">3年</option>
                        <option value="4">4年</option>
                        <option value="5">5年</option>
                    </select>
                </div>
                <span class="price3">¥37546.2<i>起</i></span>
                <input type="button" class="order" onclick="BillStart3()" value="立即续费" />
            </div>
        </div>
        @**@
   </div>
</div>


@*<div style="" class="clearfix">                                
    <button type="button" class="btn btn-Orange" onclick="BillStart()">立即结算</button>
</div>*@


<div id="mpay" style="position:absolute;top:450px;width:205px;">
<div style="width:100%;height:30px;background-color:#299d33;font-size:16pt;text-align:center;vertical-align:middle;padding-top:5px;color:white;">
        微信扫描支付</div>
    <div style="padding-top:5px;padding-left:0px;">
        <div class="A4_verPrint">
            <iframe id="FMPAY" name="FMPAY" src=""  frameborder=0 width=210 height=210 marginheight=0 marginwidth=0 scrolling=no ></iframe>
        </div>
    </div>
</div>

    <input type="hidden" value="500" id="posPrice" />
<script>
    var selectinfo = {};
    var sourceinfo = {};
    var iNum = 1;
    var iNum0 = 1;
    var iNum00 = 1;
    mini.parse();

    $(function () {
        $("#mpay").hide();
        sourceinfo["LI001"] = 500;
        sourceinfo["LI002"] = 0;
        sourceinfo["li003"] = 0;
        selectinfo["LI001"] = 500;
        selectinfo["LI002"] = 0;
        selectinfo["li003"] = 0;

        sourceinfo["LI0010"] = 500;
        sourceinfo["LI0020"] = 0;
        sourceinfo["li0030"] = 0;
        selectinfo["LI0010"] = 500;
        selectinfo["LI0020"] = 0;
        selectinfo["li0030"] = 0;

        //助手
        sourceinfo["LI00100"] = 500;
        sourceinfo["LI00200"] = 0;
        selectinfo["LI00100"] = 1;
        selectinfo["LI00200"] = 0;
        //

        load();

        var select = $('.select');
        console.log(select.length);
        for (var i = 0; i < select.length; i++) {
            select[i].index = i;
            select[i].onclick = LIItemClick;
        }

    });

    function load() {
        $.post("../Corp/GetPriceFromCorp", { mSystemAppID: parent.window.getSystemAppID() }, function (data) {
            var mdata = mini.decode(data);
            for (var i = 0; i < mdata.data.length; i++) {
                if (mdata.data[i].FProductID == 1) {
                    sourceinfo["LI002"] = selectinfo["LI002"] = mdata.data[i].FSalesPrice;
                    sourceinfo["LI0020"] = selectinfo["LI0020"] = mdata.data[i].FSalesPrice;
                }
                if (mdata.data[i].FProductID == 2) {
                    $("#posPrice").val(mdata.data[i].FSalesPrice);
                    sourceinfo["LI001"] = selectinfo["LI001"] = mdata.data[i].FSalesPrice;
                    sourceinfo["LI0010"] = selectinfo["LI0010"] = mdata.data[i].FSalesPrice;
                    $("#posPrice").val(mdata.data[i].FSalesPrice);
                }
                if (mdata.data[i].FProductID == 3) {
                    selectinfo["li003"] = sourceinfo["li003"] = mdata.data[i].FSalesPrice;
                    selectinfo["li0030"] = sourceinfo["li0030"] = mdata.data[i].FSalesPrice;
                }
                //助手
                if (mdata.data[i].FProductID == 6) {
                    sourceinfo["LI00200"] = selectinfo["LI00200"] = mdata.data[i].FSalesPrice;
                }
                //
            }
            LIItemClick();
        });
    }

    function BillStart() {
        var pos = 0;
        pos = parseFloat(selectinfo['LI001']);
        mini.open({
            url: "../System/WXPay?pos=" + selectinfo['LI001'] + "&WX=0&Num=" + iNum
                + "&BServer=" + selectinfo['LI002'] + "&mSystemAppID=" + parent.window.getSystemAppID(),
            title: "微信支付", width: 600, height: 530,
            onload: function () {
                var iframe = this.getIFrameEl();
                var data = {};
                data.AppID = parent.window.getSystemAppID();
                data.selectinfo = selectinfo;
                data.iNum = iNum;
                data.selectinfo['LI001'] = pos;
                iframe.contentWindow.SetData(data);
            }
        });
    }
    function BillStart2() {
        var pos = 0;
        pos = parseFloat(selectinfo['LI0010']);
        mini.open({
            url: "../System/WXPay?pos=" + selectinfo['LI0010'] + "&WX=" + selectinfo["li0030"] + "&Num=" + iNum0
                + "&BServer=" + selectinfo['LI0020'] + "&mSystemAppID=" + parent.window.getSystemAppID(),
            title: "微信支付", width: 600, height: 530,
            onload: function () {
                var iframe = this.getIFrameEl();
                var data = {};
                data.AppID = parent.window.getSystemAppID();
                data.selectinfo = selectinfo;
                data.iNum = iNum0;
                data.selectinfo['LI0010'] = pos;
                iframe.contentWindow.SetData(data);
            }
        });
    }

    //助手
    function BillStart3() {
        var pos = 0;
        pos = parseFloat(selectinfo['LI00100']);
        mini.open({
            url: "../System/WXPay?Ass=1&pos=" + selectinfo['LI00100'] + "&WX=0&Num=" + iNum00
                + "&BServer=0&mSystemAppID=" + parent.window.getSystemAppID(),
            title: "微信支付", width: 600, height: 530,
            onload: function () {
                var iframe = this.getIFrameEl();
                var data = {};
                data.AppID = parent.window.getSystemAppID();
                data.selectinfo = selectinfo;
                data.iNum = iNum0;
                data.selectinfo['LI00100'] = pos;
                iframe.contentWindow.SetData(data);
            }
        });
    }
    //

    var LIItemClick = function () {
        var name = $(this).attr("name");
        var option = $(this).find('option:selected');
        console.log(option.val());
        if (name == 'li0030') {
            if (option.val() == "1") {
                selectinfo[name] = sourceinfo["li0030"];
            }
            else {
                selectinfo[name] = 0;
            }
        }
        else if (name == 'LI002') {
            if (option.val() == "1") {
                selectinfo[name] = sourceinfo["LI002"];
            }
            else {
                selectinfo[name] = 0;
            }
        }
        else if (name == 'LI0020') {
            if (option.val() == "1") {
                selectinfo[name] = sourceinfo["LI0020"];
            }
            else {
                selectinfo[name] = 0;
            }
        }
        else if (name == 'LI00100') 
            selectinfo[name] = option.val();
        else {
            if (name == "iNum") { iNum = option.val(); }
            else {
                selectinfo[name] = (parseFloat(option.val())) * parseFloat($("#posPrice").val());
            }
            if (name == "iNum0") { iNum0 = option.val(); }
            else {
                selectinfo[name] = (parseFloat(option.val())) * parseFloat($("#posPrice").val());
            }
            if (name == "iNum00") { iNum00 = option.val(); }
        }

        ComputeMoney();
    }
    var ComputeMoney = function () {
        var Money1 = 0;
        var pos1 = 0;
        var Money2 = 0;
        var pos2 = 0;
        var Money3 = 0;
        if (selectinfo['LI003'] == undefined) selectinfo['LI003'] = 0;
        if (selectinfo['li0030'] == undefined) selectinfo['li0030'] = 0;
        pos1 = parseFloat(selectinfo['LI001']);
        pos2 = parseFloat(selectinfo['LI0010']);
        if (parseFloat(selectinfo['LI002']) > 0 && pos1 > 0)
            pos1 = pos1 - parseFloat($("#posPrice").val());
        if (parseFloat(selectinfo['LI0020']) > 0 && pos2 > 0)
            pos2 = pos2 - parseFloat($("#posPrice").val());
        Money1 = ((pos1 + parseFloat(selectinfo['LI002'])) + parseFloat(selectinfo['LI003'])) * iNum;
        Money2 = ((pos2 + parseFloat(selectinfo['LI0020'])) + parseFloat(selectinfo['li0030'])) * iNum0;
        Money3 = (parseFloat(selectinfo['LI00200']) * parseFloat(selectinfo['LI00100'])) * iNum00;
        $('.price3').html('¥' + Money3.toFixed(2) + "<i>起</i>");
        $('.price2').html('¥' + Money2.toFixed(2) + "<i>起</i>");
        $('.price').html('¥' + Money1.toFixed(2) + "<i>起</i>");
    }

</script>